package com.example.zerocopy.traditionCopy;

import java.io.FileInputStream;
import java.io.FileOutputStream;

public class Test {

	public static final String source = "F:\\copy\\1.txt";
	public static final String dest = "F:\\copy\\2.txt";

	public static void main(String[] args) {
		try {
			FileInputStream fis = new FileInputStream(source);
			FileOutputStream fos = new FileOutputStream(dest);
			long start = System.currentTimeMillis();
			byte[] buffer = new byte[4096];
			long read = 0;
			long total = 0;
			while ((read = fis.read(buffer)) > 0) {
				total = total + read;
				fos.write(buffer);
			}
			fos.flush();
			long end = System.currentTimeMillis();
			long time = end - start;
			System.out.println("耗时=" + time);
		} catch (Exception e) {

		}
	}
}
